package com.xmall.search.utils;

import com.xmall.define.dto.log.RetryLogDto;
import com.xmall.msg.entity.es.ProductUpdateMsg;
import com.xmall.search.entity.ProductDeleteRetryLog;
import com.xmall.search.entity.ProductUpdateRetryLog;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

public interface ConvertUtils {

    /**
     * 商品更新
     */
    @Mapper(componentModel = "spring")
    interface ProductUpdateModule {
        ProductUpdateModule INSTANCE = Mappers.getMapper(ProductUpdateModule.class);
        ProductUpdateMsg toMsg(ProductUpdateRetryLog log);
    }

    /**
     * 商品删除
     */
    @Mapper(componentModel = "spring")
    interface ProductDeleteModule {
        ProductDeleteModule INSTANCE = Mappers.getMapper(ProductDeleteModule.class);
        ProductUpdateMsg toMsg(ProductDeleteRetryLog log);
    }

    /**
     * order retry log
     */
    @Mapper(componentModel = "spring")
    interface RetryLogModule {
        RetryLogModule INSTANCE = Mappers.getMapper(RetryLogModule.class);

        RetryLogDto toDtoFromProductDelete(ProductDeleteRetryLog productDeleteRetryLog);
        RetryLogDto toDtoFromProductUpdate(ProductUpdateRetryLog productUpdateRetryLog);
    }
}
